package event

import (
	"github.com/gdamore/tcell/v2"
	"go-TcellTxt/global"
	"go-TcellTxt/utils"
)

type InputListen struct {
	//输入的内容
	data  rune
	event tcell.Event
}

// 创建一个输入事件
func NewInputListen(data rune, event tcell.Event) *InputListen {
	return &InputListen{
		data:  data,
		event: event,
	}

}

func (i *InputListen) Handler() {
	x, y := utils.InputStrMove(global.Screen, global.MouseX, global.MouseY, global.DefaultStyle, string(i.data))
	global.MouseX = x
	global.MouseY = y
}
